﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PokerClient.Connection.CommandHandlers;

namespace PokerClient.Commands.CommandFactories
{
	class revealHandler : absHandler
	{
		private VisualDisp.Table table;
	//	String message;
		reavealState state;
		public revealHandler(VisualDisp.Table table)
		{
			// TODO: Complete member initialization
			this.table = table;
		}

		public override void assignCommand(string commands)
		{
			this.commands = commands.Split(' ');
		}

		public override string work()
		{
			switch(commands[1].ToUpper())
			{
				case "FLOP":
					state = reavealState.FLOP;
					break;
				case "RIVER":
					state = reavealState.RIVER;
					break;
				case "TURN":
					state = reavealState.TURN;
					break;
				default:
					state = reavealState.PREFLOP;
					break;
			}

			return "Working";
		}

		public override void analyze()
		{
			String[] temp = commands[2].Split(',');
			switch(state)
			{
				case reavealState.FLOP:
					table.revealFlop(temp[0], temp[1], temp[2]);
					break;
				case reavealState.TURN:
					table.revealTurn(temp[0]);
					break;
				case reavealState.RIVER:
					table.revealRiver(temp[0]);
					break;
				default:
					table.resetCards();
					break;
			}

		}
	

	
	}
	public enum reavealState
	{
		FLOP,
		TURN,
		RIVER,
		PREFLOP
	}
}
